﻿using System;
using System.Data;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;

namespace AnyOffice.general.netmeeting.voice_video
{
    public partial class ajax_user : ModulePage
    {

        private string ShowInfo()
        {
            StringBuilder builder = new StringBuilder();
            DataTable table = new UsersDao().SelectOnline(base.Conn, base.User.Identity.Name);
            base.CloseConn();
            if (table.Rows.Count > 0)
            {
                builder.Append("<table border=0 cellspacing=1 width=100% bgcolor=black cellpadding=3 class=small>");
                builder.Append("<tr class=TableHeader>");
                builder.Append("<td align=center colspan=3>在线人员列表</td>");
                builder.Append("</tr>");
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    builder.Append("<tr class=TableData>");
                    builder.Append("<td align=center>" + table.Rows[i]["UserName"].ToString() + "</td>");
                    builder.Append("<td align=center>" + ((table.Rows[i]["LastIp"] != DBNull.Value) ? table.Rows[i]["LastIp"].ToString() : "") + "</td>");
                    builder.Append("<td align=center><a href=javascript:mycall('" + ((table.Rows[i]["LastIp"] != DBNull.Value) ? table.Rows[i]["LastIp"].ToString() : "") + "')>呼叫</a></td>");
                    builder.Append("</tr>");
                }
                builder.Append("</table>");
            }
            return builder.ToString();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.AppendHeader("Expires", DateTime.Now.AddDays(-1.0).ToString("r"));
            Response.AppendHeader("Pragma", "no-cache");
            Response.AppendHeader("Cache-Control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
            Response.Clear();
            Response.Write(this.ShowInfo());
            Response.End();
        }
        protected override void ThemeWrite()
        {
        }
    }
}
